VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clImpresion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Sub InicializarReporte(ByRef CtrlRpt As CrystalReport, _
    ByVal strNombreReporte As String, _
    ByVal strArchivo As String, Optional miRuta)
    
    Dim rst As ADODB.Recordset
    Dim sRutaReportes$
    
    If IsMissing(miRuta) Then
        Set rst = New ADODB.Recordset
        rst.Open "select rtrim(ruta_reportes) from sacf_planillas.dbo.parametros", DE.Cnn, adOpenStatic, adLockOptimistic, adCmdText
        If Not rst.EOF Then
            If Right(rst.Fields(0), 1) <> "\" Then
                sRutaReportes = rst.Fields(0) & "\"
            Else
                sRutaReportes = rst.Fields(0)
            End If
        End If
        rst.Close
        Set rst = Nothing
    Else
        sRutaReportes = miRuta
    End If
    
    With CtrlRpt
        .Reset
        .WindowTitle = strNombreReporte
        .WindowShowPrintBtn = True
        .WindowShowPrintSetupBtn = True
        .WindowShowSearchBtn = True
        .WindowState = crptMaximized
        .WindowShowZoomCtl = True
        .ReportFileName = sRutaReportes & strArchivo
'        .Formulas("50") = "GLBFECHAHORA='" & gFECHA_HORA_SERVIDOR & "'"
'        .Formulas("51") = "GLBUSUARIO='" & gNOMBRE_USUARIO & "'"
    End With
End Sub

Sub MostrarReporte(ByRef CtrlRpt As CrystalReport, ByVal Destino As Crystal.DestinationConstants)
    CtrlRpt.Destination = Destino
    CtrlRpt.Action = 1
End Sub

